sndobj-devel Mailing List for The Sound Object Library (Page 16)
Status: Abandoned
Brought to you by:
veplaini
This list is closed, nobody may subscribe to it.
2007 |
Jan
(57) |
Feb
(16) |
Mar
(5) |
Apr
|
May
|
Jun
|
Jul
(8) |
Aug
(24) |
Sep
(12) |
Oct
(4) |
Nov
(11) |
Dec
(9) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(9) |
Feb
(13) |
Mar
(3) |
Apr
(10) |
May
(11) |
Jun
(12) |
Jul
(8) |
Aug
(9) |
Sep
(1) |
Oct
(24) |
Nov
(11) |
Dec
(19) |
2009 |
Jan
(5) |
Feb
(24) |
Mar
(43) |
Apr
(9) |
May
(14) |
Jun
(28) |
Jul
|
Aug
(6) |
Sep
|
Oct
(4) |
Nov
(10) |
Dec
|
2010 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
(2) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(9) |
Dec
|
2011 |
Jan
(3) |
Feb
(3) |
Mar
|
Apr
|
May
(2) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2012 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
2013 |
Jan
(2) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
2017 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Rory W. <ror...@ea...> - 2007-03-19 22:33:18
|
I'm getting some odd behaviour with a simple Sndobj app I'm building with wxWidgets. I have the following simple code: ... SndWave input("Radiohead.wav", READ); SndRTIO output(1, SND_OUTPUT); SndIn signal(&input); output.SetOutput(1, &signal); for(int i=0; i<dur*(DEF_SR/DEF_VECSIZE); i++) { input.Read(); signal.DoProcess(); output.Write(); } ... When ran as a command line app it works fine and plays the audio. If I insert it to an OnButtonPress() method it causes a crash. I know I should be using threads but I'm trying to show some students why threads are necessary. Running this code should play some audio even though the application will freeze for 10 seconds. I'm using windows and MinGW. Any ideas? Rory. |
From: Victor L. <vic...@nu...> - 2007-02-16 14:39:52
|
I'll have to check TpTz. But perhaps you can combine the original signal with the butterworth signal and apply two different gains. Rasing the gain of the BP signal would emphasise that freq band, but the others would still pass. There might be some funny phase interaction between the filter and the original signal, so I can't say it will work. Victor > > Wouldn't this reject everything outside the BW of the > filter? > > I have tried combining a butterworth band-pass with a > band-reject (in parallel), but they don't combine well. > You can hear the change at unity gain. I thought there was > probably a better way, so I dropped it. > > I want to be able to vary the gain on a range of > frequencies without changing other frequencies much. > > BTW, I have been looking around more and I have found a > set of equations for coefficients that should do what I > want. > > http://www.madstudio.lsu.edu/references/music/csound/manual/sigmod/pareq.htm > > But I have not yet gotten them to work (I'm not sure what > is wrong). They have 6 coefficients instead of the 5 used > by TpTz, so I assumed that a0 is the output gain to > compensate for the filter. Is all this reasonable? Also I > think the a's and b's are reversed between this page and > TpTz. Is this true? > > Thanks. > -Arthur > > On 2/16/07, Victor Lazzarini <vic...@nu...> > wrote: > > > I would use a butterworth filter (or two in series for > > 4th order filter) with a gain object in its output. > > Would that do? > > > > all the best > > > > Victor > > > > > > I am using the Python binding of the library. It is > > > quite nice. > > > > > > However I cannot find a filter that is suitable for > > > use as a parametric filter. Is there a class that > > > provides a variable gain band pass/reject filter? Or > > > is there an easy way to build one out of other > > components? > > > > I'm sorry if this is a stupid question. I feel as if I > > > should know how to solve this. > > > > > > Thanks a lot. > > > -Arthur > > > > > > -- > > > Home page: www.singingwizard.org > > > > > > > > > > ---------------------------------------------------------- > > > --------------- Take Surveys. Earn Cash. Influence the > > > Future of IT Join SourceForge.net's Techsay panel and > > > you'll get the chance to share your opinions on IT & > > business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > _______________________________________________ > > > Sndobj-devel mailing list > > > Snd...@li... > > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > > > > -- > Home page: www.singingwizard.org > > ---------------------------------------------------------- > --------------- Take Surveys. Earn Cash. Influence the > Future of IT Join SourceForge.net's Techsay panel and > you'll get the chance to share your opinions on IT & > business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel |
From: Arthur P. <am...@si...> - 2007-02-16 14:04:12
|
Wouldn't this reject everything outside the BW of the filter? I have tried combining a butterworth band-pass with a band-reject (in parallel), but they don't combine well. You can hear the change at unity gain. I thought there was probably a better way, so I dropped it. I want to be able to vary the gain on a range of frequencies without changing other frequencies much. BTW, I have been looking around more and I have found a set of equations for coefficients that should do what I want. http://www.madstudio.lsu.edu/references/music/csound/manual/sigmod/pareq.htm But I have not yet gotten them to work (I'm not sure what is wrong). They have 6 coefficients instead of the 5 used by TpTz, so I assumed that a0 is the output gain to compensate for the filter. Is all this reasonable? Also I think the a's and b's are reversed between this page and TpTz. Is this true? Thanks. -Arthur On 2/16/07, Victor Lazzarini <vic...@nu...> wrote: > > I would use a butterworth filter (or two in series for > 4th order filter) with a gain object in its output. > Would that do? > > all the best > > Victor > > > > I am using the Python binding of the library. It is quite > > nice. > > > > However I cannot find a filter that is suitable for use as > > a parametric filter. Is there a class that provides a > > variable gain band pass/reject filter? Or is there an easy > > way to build one out of other components? > > > > I'm sorry if this is a stupid question. I feel as if I > > should know how to solve this. > > > > Thanks a lot. > > -Arthur > > > > -- > > Home page: www.singingwizard.org > > > > ---------------------------------------------------------- > > --------------- Take Surveys. Earn Cash. Influence the > > Future of IT Join SourceForge.net's Techsay panel and > > you'll get the chance to share your opinions on IT & > > business topics through brief surveys-and earn cash > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Sndobj-devel mailing list > > Snd...@li... > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > -- Home page: www.singingwizard.org |
From: Victor L. <vic...@nu...> - 2007-02-16 11:16:33
|
I would use a butterworth filter (or two in series for 4th order filter) with a gain object in its output. Would that do? all the best Victor > > I am using the Python binding of the library. It is quite > nice. > > However I cannot find a filter that is suitable for use as > a parametric filter. Is there a class that provides a > variable gain band pass/reject filter? Or is there an easy > way to build one out of other components? > > I'm sorry if this is a stupid question. I feel as if I > should know how to solve this. > > Thanks a lot. > -Arthur > > -- > Home page: www.singingwizard.org > > ---------------------------------------------------------- > --------------- Take Surveys. Earn Cash. Influence the > Future of IT Join SourceForge.net's Techsay panel and > you'll get the chance to share your opinions on IT & > business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel |
From: Arthur P. <am...@si...> - 2007-02-16 00:42:27
|
I am using the Python binding of the library. It is quite nice. However I cannot find a filter that is suitable for use as a parametric filter. Is there a class that provides a variable gain band pass/reject filter? Or is there an easy way to build one out of other components? I'm sorry if this is a stupid question. I feel as if I should know how to solve this. Thanks a lot. -Arthur -- Home page: www.singingwizard.org |
From: Raj M. <raj...@ya...> - 2007-02-15 23:32:05
|
Hello Sir, I tried your release 2.6.4 on mac osx tiger. None of the binaries generated are able to take Microphone input and process them. Need help. Thanks, Raj ____________________________________________________________________________________ Finding fabulous fares is fun. Let Yahoo! FareChase search your favorite travel sites to find flight and hotel bargains. http://farechase.yahoo.com/promo-generic-14795097 |
From: Victor L. <Vic...@nu...> - 2007-02-08 08:49:33
|
Generally speaking, you don't want or need to touch protected members. If there is a need for accessing it, the way to do it is to provide a Get/Set method in C++, which will be wrapped in Swig. In Python, AFAIK, all members are public, so if you could inherit the whole C++ class, you would be able to access it. Swig, quite properly, does not let you do that. In the specific case of m_vecpos, it might not be a good idea to touch it, since it is an internal sample counter. If there is a funcionality missing in a Class then a method should be added to provide it. all the best Victor At 20:52 06/02/2007, Craig Lewiston wrote: >you're right, there's no need to inherit and create a new class. > >the way i arrived at that solution was that i was trying to access the >protected variable m_vecpos from the SndIO class (was trying to access >this in an instance of SndWave). that's why i tried inheriting, >because m_vecpos is protected. however, even when i inherited, i >wasn't able to access m_vecpos, which i now believe is due to the SWIG >interface between python and the cpp code. > >i had missed that SndWave is derived from SndFIO which is derived from >SndIO (was only looking at the documentation for SndWave, and not at >the library class tree near the beginning of the documentation). >Since SetPos() is defined in SndFIO, i didn't know that it was a >method available to SndWave. > >all that said, is there a method for accessing protected variables >such as m_vecpos from Python? When i run dir() on a SndWave object, >i see the following methods that might be able to accomplish this: > >__getattr__ >__getattribute__ >__setattr__ > >can you suggest where i can find out how to use these? > >anyway, thanks for the continued help, >Craig > > > >On 2/6/07, Victor Lazzarini <Vic...@nu...> wrote: >>Looks good. But couldn't you just call sndobj.SndWave.SetPos(0) directly? >>Inheriting is useful, though. >> >>all the best >> >>Victor >> >>At 08:03 06/02/2007, Craig Lewiston wrote: >> >I was able to figure out how to reset the vector position for the >> >SndWave() Class. Basically, you just inherit the class into a new >> >class, and create a method to set the vector position: >> > >> >class N_SndWave(sndobj.SndWave): >> > def resetpos(self): >> > self.SetPos(0) >> > >> >of course, you could also create another method to set the vector >> >position to whatever point you want: >> > >> >class N_SndWave(sndobj.SndWave): >> > def resetpos(self): >> > self.SetPos(0) >> > def setpos(self, offset): >> > self.SetPos(offset) >> > >> > >> >so, in order play a wav file, then reset and play it again, you would >> >do the following: >> >------ >> >class N_SndWave(sndobj.SndWave): >> > def resetpos(self): >> > self.SetPos(0) >> > >> >wavfile = N_SndWave('C261.wav', 3) >> >wavsoundL = sndobj.SndIn(wavfile,1) >> >wavsoundR = sndobj.SndIn(wavfile,2) >> >outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) >> >outp.SetOutput(2, wavsoundR) >> >outp.SetOutput(1, wavsoundL) >> > >> >N1 = sndobj.SndThread() >> >N1.AddObj(wavfile,sndobj.SNDIO_IN) >> >N1.AddObj(wavsoundR) >> >N1.AddObj(wavsoundL) >> >N1.AddObj(outp, sndobj.SNDIO_OUT) >> > >> >N1.ProcOn() >> >time.sleep(1) >> >wavfile.resetpos() >> >time.sleep(1) >> >N1.ProcOff() >> >------- >> >by blocks, the above code: >> >1) Defines new class inherited from SndWave, with method for resetting >> >vector position >> >2) Sets up standard SndIn->SndObj->SndIO chain, in this case using 2 >> >channels (L&R) >> >3) Setup SndThread object and add components from 2) >> >4) Turns SndThread on, plays for 1 second, resets vector to beginning, >> >plays for 1 second, and then stops processing. >> > >> >This seems to do the trick, and the playback is very clean. >> > >> >-Craig >> > >> > >> > >> >On 2/5/07, Craig Lewiston <lew...@mi...> wrote: >> > > I tried #1 & #3 extensively, as well as tinkering with SndRead() >> > > quite a bit. I'm starting to think that in order to accomplish what i >> > > want, I need to be able to reset SndWave() to start reading again from >> > > the beginning of the file. From the documentation for Class SndIO, it >> > > appears that the protected variable m_vecpos holds the value of the >> > > current "place reader" in the wav file. Is there any way to access >> > > this to reset it? >> > > >> > > Better yet, is there a way to copy the wav sample into memory and have >> > > it triggered? >> > > >> > > -Craig >> > > >> > > >> > > >> > > On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: >> > > > Off the top of my head: >> > > > >> > > > 1. Using Enable() and Disable() on the SndIn object to >> > > > switch it on an off. You might get clicks. >> > > > >> > > > 2. Using an envelope (eg. Interp + Ring) and >> > > > trigger the envelope (SetCurve()) on/off. >> > > > Use Ring to multiply the envelope signal by the >> > > > SndIn signal. >> > > > >> > > > 3. If you delete the Wave reader object from >> > > > the thread it will also stop reading the file >> > > > (but SndIn will also need to be disabled) >> > > > >> > > > 4. Have a look at the SndRead class. Another >> > > > alternative is to load the file on a table and >> > > > read it with an oscillator or with Lookup/i >> > > > >> > > > You're right in that ProcOn() and ProcOff() should >> > > > perhaps just be used at the start/end of synthesis. >> > > > >> > > > Victor >> > > > >> > > > >> > > > > >> > > > > Anyone have advice on the best route to creating triggered >> > > > > file playback? I'd like to have my program be able to >> > > > > start the playback of a wav file when a flag is set, and >> > > > > then cease playback of that file once the flag is reset. >> > > > > i want this to happen in a thread, though, because there >> > > > > will be other processing (and sounds) taking place (such >> > > > > as a metronome) while the file is playing back. also, the >> > > > > length of playback will vary depending on when the flag is >> > > > > reset (which is controlled by user input) >> > > > > >> > > > > i'm using SndWave, and patching both channels into SndIn >> > > > > objects. everything is then added to a SndThread: >> > > > > ---------------------- >> > > > > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) >> > > > > wavsoundR = sndobj.SndIn(wavfile,1) >> > > > > wavsoundL = sndobj.SndIn(wavfile,2) >> > > > > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) >> > > > > outp.SetOutput(2, wavsoundR) >> > > > > outp.SetOutput(1, wavsoundL) >> > > > > >> > > > > IT = sndobj.SndThread() >> > > > > IT.AddObj(wavfile,sndobj.SNDIO_IN) >> > > > > IT.AddObj(wavsoundR) >> > > > > IT.AddObj(wavsoundL) >> > > > > IT.AddObj(outp, sndobj.SNDIO_OUT) >> > > > > >> > > > > IT.ProcOn() >> > > > > time.sleep(5) >> > > > > IT.ProcOff() >> > > > > ----------------------------------- >> > > > > >> > > > > I thought about just turning the thread on and off, but >> > > > > when the thread is turned on again after being turned off, >> > > > > it just resumes processing where it left off. is there a >> > > > > way i can get it to resume from the beginnig of the wav >> > > > > file? >> > > > > >> > > > > >> > > > > thanks, >> > > > > craig >> > > > > >> > > > > ---------------------------------------------------------- >> > > > > --------------- Using Tomcat but need to do more? Need to >> > > > > support web services, security? Get stuff done quickly >> > > > > with pre-integrated technology to make your job easier. >> > > > > Download IBM WebSphere Application Server v.1.0.1 based on >> > > > > Apache Geronimo >> > > > > >> > > > >> http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> > > > > _______________________________________________ >> > > > > Sndobj-devel mailing list >> > > > > Snd...@li... >> > > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel >> > > > >> > > >> > >> >------------------------------------------------------------------------- >> >Using Tomcat but need to do more? Need to support web services, security? >> >Get stuff done quickly with pre-integrated technology to make your job >> easier. >> >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >> >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >> >_______________________________________________ >> >Sndobj-devel mailing list >> >Snd...@li... >> >https://lists.sourceforge.net/lists/listinfo/sndobj-devel >> >>Victor Lazzarini >>Music Technology Laboratory >>Music Department >>National University of Ireland, Maynooth >> > >Victor Lazzarini >Music Technology Laboratory >Music Department >National University of Ireland, Maynooth |
From: Craig L. <lew...@mi...> - 2007-02-06 20:52:29
|
you're right, there's no need to inherit and create a new class. the way i arrived at that solution was that i was trying to access the protected variable m_vecpos from the SndIO class (was trying to access this in an instance of SndWave). that's why i tried inheriting, because m_vecpos is protected. however, even when i inherited, i wasn't able to access m_vecpos, which i now believe is due to the SWIG interface between python and the cpp code. i had missed that SndWave is derived from SndFIO which is derived from SndIO (was only looking at the documentation for SndWave, and not at the library class tree near the beginning of the documentation). Since SetPos() is defined in SndFIO, i didn't know that it was a method available to SndWave. all that said, is there a method for accessing protected variables such as m_vecpos from Python? When i run dir() on a SndWave object, i see the following methods that might be able to accomplish this: __getattr__ __getattribute__ __setattr__ can you suggest where i can find out how to use these? anyway, thanks for the continued help, Craig On 2/6/07, Victor Lazzarini <Vic...@nu...> wrote: > Looks good. But couldn't you just call sndobj.SndWave.SetPos(0) directly? > Inheriting is useful, though. > > all the best > > Victor > > At 08:03 06/02/2007, Craig Lewiston wrote: > >I was able to figure out how to reset the vector position for the > >SndWave() Class. Basically, you just inherit the class into a new > >class, and create a method to set the vector position: > > > >class N_SndWave(sndobj.SndWave): > > def resetpos(self): > > self.SetPos(0) > > > >of course, you could also create another method to set the vector > >position to whatever point you want: > > > >class N_SndWave(sndobj.SndWave): > > def resetpos(self): > > self.SetPos(0) > > def setpos(self, offset): > > self.SetPos(offset) > > > > > >so, in order play a wav file, then reset and play it again, you would > >do the following: > >------ > >class N_SndWave(sndobj.SndWave): > > def resetpos(self): > > self.SetPos(0) > > > >wavfile = N_SndWave('C261.wav', 3) > >wavsoundL = sndobj.SndIn(wavfile,1) > >wavsoundR = sndobj.SndIn(wavfile,2) > >outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > >outp.SetOutput(2, wavsoundR) > >outp.SetOutput(1, wavsoundL) > > > >N1 = sndobj.SndThread() > >N1.AddObj(wavfile,sndobj.SNDIO_IN) > >N1.AddObj(wavsoundR) > >N1.AddObj(wavsoundL) > >N1.AddObj(outp, sndobj.SNDIO_OUT) > > > >N1.ProcOn() > >time.sleep(1) > >wavfile.resetpos() > >time.sleep(1) > >N1.ProcOff() > >------- > >by blocks, the above code: > >1) Defines new class inherited from SndWave, with method for resetting > >vector position > >2) Sets up standard SndIn->SndObj->SndIO chain, in this case using 2 > >channels (L&R) > >3) Setup SndThread object and add components from 2) > >4) Turns SndThread on, plays for 1 second, resets vector to beginning, > >plays for 1 second, and then stops processing. > > > >This seems to do the trick, and the playback is very clean. > > > >-Craig > > > > > > > >On 2/5/07, Craig Lewiston <lew...@mi...> wrote: > > > I tried #1 & #3 extensively, as well as tinkering with SndRead() > > > quite a bit. I'm starting to think that in order to accomplish what i > > > want, I need to be able to reset SndWave() to start reading again from > > > the beginning of the file. From the documentation for Class SndIO, it > > > appears that the protected variable m_vecpos holds the value of the > > > current "place reader" in the wav file. Is there any way to access > > > this to reset it? > > > > > > Better yet, is there a way to copy the wav sample into memory and have > > > it triggered? > > > > > > -Craig > > > > > > > > > > > > On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: > > > > Off the top of my head: > > > > > > > > 1. Using Enable() and Disable() on the SndIn object to > > > > switch it on an off. You might get clicks. > > > > > > > > 2. Using an envelope (eg. Interp + Ring) and > > > > trigger the envelope (SetCurve()) on/off. > > > > Use Ring to multiply the envelope signal by the > > > > SndIn signal. > > > > > > > > 3. If you delete the Wave reader object from > > > > the thread it will also stop reading the file > > > > (but SndIn will also need to be disabled) > > > > > > > > 4. Have a look at the SndRead class. Another > > > > alternative is to load the file on a table and > > > > read it with an oscillator or with Lookup/i > > > > > > > > You're right in that ProcOn() and ProcOff() should > > > > perhaps just be used at the start/end of synthesis. > > > > > > > > Victor > > > > > > > > > > > > > > > > > > Anyone have advice on the best route to creating triggered > > > > > file playback? I'd like to have my program be able to > > > > > start the playback of a wav file when a flag is set, and > > > > > then cease playback of that file once the flag is reset. > > > > > i want this to happen in a thread, though, because there > > > > > will be other processing (and sounds) taking place (such > > > > > as a metronome) while the file is playing back. also, the > > > > > length of playback will vary depending on when the flag is > > > > > reset (which is controlled by user input) > > > > > > > > > > i'm using SndWave, and patching both channels into SndIn > > > > > objects. everything is then added to a SndThread: > > > > > ---------------------- > > > > > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) > > > > > wavsoundR = sndobj.SndIn(wavfile,1) > > > > > wavsoundL = sndobj.SndIn(wavfile,2) > > > > > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > > > > > outp.SetOutput(2, wavsoundR) > > > > > outp.SetOutput(1, wavsoundL) > > > > > > > > > > IT = sndobj.SndThread() > > > > > IT.AddObj(wavfile,sndobj.SNDIO_IN) > > > > > IT.AddObj(wavsoundR) > > > > > IT.AddObj(wavsoundL) > > > > > IT.AddObj(outp, sndobj.SNDIO_OUT) > > > > > > > > > > IT.ProcOn() > > > > > time.sleep(5) > > > > > IT.ProcOff() > > > > > ----------------------------------- > > > > > > > > > > I thought about just turning the thread on and off, but > > > > > when the thread is turned on again after being turned off, > > > > > it just resumes processing where it left off. is there a > > > > > way i can get it to resume from the beginnig of the wav > > > > > file? > > > > > > > > > > > > > > > thanks, > > > > > craig > > > > > > > > > > ---------------------------------------------------------- > > > > > --------------- Using Tomcat but need to do more? Need to > > > > > support web services, security? Get stuff done quickly > > > > > with pre-integrated technology to make your job easier. > > > > > Download IBM WebSphere Application Server v.1.0.1 based on > > > > > Apache Geronimo > > > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > > _______________________________________________ > > > > > Sndobj-devel mailing list > > > > > Snd...@li... > > > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > > > > > > > > > >------------------------------------------------------------------------- > >Using Tomcat but need to do more? Need to support web services, security? > >Get stuff done quickly with pre-integrated technology to make your job easier. > >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > >_______________________________________________ > >Sndobj-devel mailing list > >Snd...@li... > >https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > Victor Lazzarini > Music Technology Laboratory > Music Department > National University of Ireland, Maynooth > > |
From: Victor L. <Vic...@nu...> - 2007-02-06 14:44:59
|
SndBuffer is fixed now in CVS. Here's an example that runs an oscillator in one thread and outputs it in another. import sndobj import time # sndbuffer (size = 4 x vectorsize) buf = sndobj.SndBuffer(1,1024) # wavetable harm = sndobj.HarmTable(10000,1,1) # thread 1 # outputs to buf t1 = sndobj.SndThread() osc = sndobj.Oscili(harm, 440, 10000) buf.SetOutput(1, osc) t1.AddObj(osc) t1.AddObj(buf, sndobj.SNDIO_OUT) # thread 2 # input from buf # output to outp t2 = sndobj.SndThread() sound = sndobj.SndIn(buf, 1) outp = sndobj.SndRTIO(sound) t2.AddObj(buf, sndobj.SNDIO_IN) t2.AddObj(sound) t2.AddObj(outp, sndobj.SNDIO_OUT) t1.ProcOn() t2.ProcOn() time.sleep(10) t2.ProcOff() t1.ProcOff() Victor At 12:06 06/02/2007, you wrote: >It looks like some of the latest changes to the lib might have broken >SndBuffer. I am looking at fixing it now. I will post an example when >I am done > >At 03:26 06/02/2007, you wrote: > >Does anyone have any code employing the SndBuffer Class that they'd > >care to post to give as an example? I'm interested in anything, but > >am specifically looking for examples where the Buffer passes data > >between different threads. > > > >Thanks, > >Craig > > > >------------------------------------------------------------------------- > >Using Tomcat but need to do more? Need to support web services, security? > >Get stuff done quickly with pre-integrated technology to make your job > easier. > >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo > >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > >_______________________________________________ > >Sndobj-devel mailing list > >Snd...@li... > >https://lists.sourceforge.net/lists/listinfo/sndobj-devel > >Victor Lazzarini >Music Technology Laboratory >Music Department >National University of Ireland, Maynooth > > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier. >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Sndobj-devel mailing list >Snd...@li... >https://lists.sourceforge.net/lists/listinfo/sndobj-devel Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
From: Victor L. <Vic...@nu...> - 2007-02-06 12:06:27
|
It looks like some of the latest changes to the lib might have broken SndBuffer. I am looking at fixing it now. I will post an example when I am done At 03:26 06/02/2007, you wrote: >Does anyone have any code employing the SndBuffer Class that they'd >care to post to give as an example? I'm interested in anything, but >am specifically looking for examples where the Buffer passes data >between different threads. > >Thanks, >Craig > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier. >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Sndobj-devel mailing list >Snd...@li... >https://lists.sourceforge.net/lists/listinfo/sndobj-devel Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
From: Victor L. <Vic...@nu...> - 2007-02-06 10:21:41
|
Looks good. But couldn't you just call sndobj.SndWave.SetPos(0) directly? Inheriting is useful, though. all the best Victor At 08:03 06/02/2007, Craig Lewiston wrote: >I was able to figure out how to reset the vector position for the >SndWave() Class. Basically, you just inherit the class into a new >class, and create a method to set the vector position: > >class N_SndWave(sndobj.SndWave): > def resetpos(self): > self.SetPos(0) > >of course, you could also create another method to set the vector >position to whatever point you want: > >class N_SndWave(sndobj.SndWave): > def resetpos(self): > self.SetPos(0) > def setpos(self, offset): > self.SetPos(offset) > > >so, in order play a wav file, then reset and play it again, you would >do the following: >------ >class N_SndWave(sndobj.SndWave): > def resetpos(self): > self.SetPos(0) > >wavfile = N_SndWave('C261.wav', 3) >wavsoundL = sndobj.SndIn(wavfile,1) >wavsoundR = sndobj.SndIn(wavfile,2) >outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) >outp.SetOutput(2, wavsoundR) >outp.SetOutput(1, wavsoundL) > >N1 = sndobj.SndThread() >N1.AddObj(wavfile,sndobj.SNDIO_IN) >N1.AddObj(wavsoundR) >N1.AddObj(wavsoundL) >N1.AddObj(outp, sndobj.SNDIO_OUT) > >N1.ProcOn() >time.sleep(1) >wavfile.resetpos() >time.sleep(1) >N1.ProcOff() >------- >by blocks, the above code: >1) Defines new class inherited from SndWave, with method for resetting >vector position >2) Sets up standard SndIn->SndObj->SndIO chain, in this case using 2 >channels (L&R) >3) Setup SndThread object and add components from 2) >4) Turns SndThread on, plays for 1 second, resets vector to beginning, >plays for 1 second, and then stops processing. > >This seems to do the trick, and the playback is very clean. > >-Craig > > > >On 2/5/07, Craig Lewiston <lew...@mi...> wrote: > > I tried #1 & #3 extensively, as well as tinkering with SndRead() > > quite a bit. I'm starting to think that in order to accomplish what i > > want, I need to be able to reset SndWave() to start reading again from > > the beginning of the file. From the documentation for Class SndIO, it > > appears that the protected variable m_vecpos holds the value of the > > current "place reader" in the wav file. Is there any way to access > > this to reset it? > > > > Better yet, is there a way to copy the wav sample into memory and have > > it triggered? > > > > -Craig > > > > > > > > On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: > > > Off the top of my head: > > > > > > 1. Using Enable() and Disable() on the SndIn object to > > > switch it on an off. You might get clicks. > > > > > > 2. Using an envelope (eg. Interp + Ring) and > > > trigger the envelope (SetCurve()) on/off. > > > Use Ring to multiply the envelope signal by the > > > SndIn signal. > > > > > > 3. If you delete the Wave reader object from > > > the thread it will also stop reading the file > > > (but SndIn will also need to be disabled) > > > > > > 4. Have a look at the SndRead class. Another > > > alternative is to load the file on a table and > > > read it with an oscillator or with Lookup/i > > > > > > You're right in that ProcOn() and ProcOff() should > > > perhaps just be used at the start/end of synthesis. > > > > > > Victor > > > > > > > > > > > > > > Anyone have advice on the best route to creating triggered > > > > file playback? I'd like to have my program be able to > > > > start the playback of a wav file when a flag is set, and > > > > then cease playback of that file once the flag is reset. > > > > i want this to happen in a thread, though, because there > > > > will be other processing (and sounds) taking place (such > > > > as a metronome) while the file is playing back. also, the > > > > length of playback will vary depending on when the flag is > > > > reset (which is controlled by user input) > > > > > > > > i'm using SndWave, and patching both channels into SndIn > > > > objects. everything is then added to a SndThread: > > > > ---------------------- > > > > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) > > > > wavsoundR = sndobj.SndIn(wavfile,1) > > > > wavsoundL = sndobj.SndIn(wavfile,2) > > > > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > > > > outp.SetOutput(2, wavsoundR) > > > > outp.SetOutput(1, wavsoundL) > > > > > > > > IT = sndobj.SndThread() > > > > IT.AddObj(wavfile,sndobj.SNDIO_IN) > > > > IT.AddObj(wavsoundR) > > > > IT.AddObj(wavsoundL) > > > > IT.AddObj(outp, sndobj.SNDIO_OUT) > > > > > > > > IT.ProcOn() > > > > time.sleep(5) > > > > IT.ProcOff() > > > > ----------------------------------- > > > > > > > > I thought about just turning the thread on and off, but > > > > when the thread is turned on again after being turned off, > > > > it just resumes processing where it left off. is there a > > > > way i can get it to resume from the beginnig of the wav > > > > file? > > > > > > > > > > > > thanks, > > > > craig > > > > > > > > ---------------------------------------------------------- > > > > --------------- Using Tomcat but need to do more? Need to > > > > support web services, security? Get stuff done quickly > > > > with pre-integrated technology to make your job easier. > > > > Download IBM WebSphere Application Server v.1.0.1 based on > > > > Apache Geronimo > > > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > > _______________________________________________ > > > > Sndobj-devel mailing list > > > > Snd...@li... > > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > > > > > >------------------------------------------------------------------------- >Using Tomcat but need to do more? Need to support web services, security? >Get stuff done quickly with pre-integrated technology to make your job easier. >Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo >http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 >_______________________________________________ >Sndobj-devel mailing list >Snd...@li... >https://lists.sourceforge.net/lists/listinfo/sndobj-devel Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
From: Craig L. <lew...@mi...> - 2007-02-06 08:03:27
|
I was able to figure out how to reset the vector position for the SndWave() Class. Basically, you just inherit the class into a new class, and create a method to set the vector position: class N_SndWave(sndobj.SndWave): def resetpos(self): self.SetPos(0) of course, you could also create another method to set the vector position to whatever point you want: class N_SndWave(sndobj.SndWave): def resetpos(self): self.SetPos(0) def setpos(self, offset): self.SetPos(offset) so, in order play a wav file, then reset and play it again, you would do the following: ------ class N_SndWave(sndobj.SndWave): def resetpos(self): self.SetPos(0) wavfile = N_SndWave('C261.wav', 3) wavsoundL = sndobj.SndIn(wavfile,1) wavsoundR = sndobj.SndIn(wavfile,2) outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) outp.SetOutput(2, wavsoundR) outp.SetOutput(1, wavsoundL) N1 = sndobj.SndThread() N1.AddObj(wavfile,sndobj.SNDIO_IN) N1.AddObj(wavsoundR) N1.AddObj(wavsoundL) N1.AddObj(outp, sndobj.SNDIO_OUT) N1.ProcOn() time.sleep(1) wavfile.resetpos() time.sleep(1) N1.ProcOff() ------- by blocks, the above code: 1) Defines new class inherited from SndWave, with method for resetting vector position 2) Sets up standard SndIn->SndObj->SndIO chain, in this case using 2 channels (L&R) 3) Setup SndThread object and add components from 2) 4) Turns SndThread on, plays for 1 second, resets vector to beginning, plays for 1 second, and then stops processing. This seems to do the trick, and the playback is very clean. -Craig On 2/5/07, Craig Lewiston <lew...@mi...> wrote: > I tried #1 & #3 extensively, as well as tinkering with SndRead() > quite a bit. I'm starting to think that in order to accomplish what i > want, I need to be able to reset SndWave() to start reading again from > the beginning of the file. From the documentation for Class SndIO, it > appears that the protected variable m_vecpos holds the value of the > current "place reader" in the wav file. Is there any way to access > this to reset it? > > Better yet, is there a way to copy the wav sample into memory and have > it triggered? > > -Craig > > > > On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: > > Off the top of my head: > > > > 1. Using Enable() and Disable() on the SndIn object to > > switch it on an off. You might get clicks. > > > > 2. Using an envelope (eg. Interp + Ring) and > > trigger the envelope (SetCurve()) on/off. > > Use Ring to multiply the envelope signal by the > > SndIn signal. > > > > 3. If you delete the Wave reader object from > > the thread it will also stop reading the file > > (but SndIn will also need to be disabled) > > > > 4. Have a look at the SndRead class. Another > > alternative is to load the file on a table and > > read it with an oscillator or with Lookup/i > > > > You're right in that ProcOn() and ProcOff() should > > perhaps just be used at the start/end of synthesis. > > > > Victor > > > > > > > > > > Anyone have advice on the best route to creating triggered > > > file playback? I'd like to have my program be able to > > > start the playback of a wav file when a flag is set, and > > > then cease playback of that file once the flag is reset. > > > i want this to happen in a thread, though, because there > > > will be other processing (and sounds) taking place (such > > > as a metronome) while the file is playing back. also, the > > > length of playback will vary depending on when the flag is > > > reset (which is controlled by user input) > > > > > > i'm using SndWave, and patching both channels into SndIn > > > objects. everything is then added to a SndThread: > > > ---------------------- > > > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) > > > wavsoundR = sndobj.SndIn(wavfile,1) > > > wavsoundL = sndobj.SndIn(wavfile,2) > > > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > > > outp.SetOutput(2, wavsoundR) > > > outp.SetOutput(1, wavsoundL) > > > > > > IT = sndobj.SndThread() > > > IT.AddObj(wavfile,sndobj.SNDIO_IN) > > > IT.AddObj(wavsoundR) > > > IT.AddObj(wavsoundL) > > > IT.AddObj(outp, sndobj.SNDIO_OUT) > > > > > > IT.ProcOn() > > > time.sleep(5) > > > IT.ProcOff() > > > ----------------------------------- > > > > > > I thought about just turning the thread on and off, but > > > when the thread is turned on again after being turned off, > > > it just resumes processing where it left off. is there a > > > way i can get it to resume from the beginnig of the wav > > > file? > > > > > > > > > thanks, > > > craig > > > > > > ---------------------------------------------------------- > > > --------------- Using Tomcat but need to do more? Need to > > > support web services, security? Get stuff done quickly > > > with pre-integrated technology to make your job easier. > > > Download IBM WebSphere Application Server v.1.0.1 based on > > > Apache Geronimo > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > _______________________________________________ > > > Sndobj-devel mailing list > > > Snd...@li... > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > > |
From: Craig L. <cra...@gm...> - 2007-02-06 07:25:33
|
I was able to figure out how to reset the vector position for the SndWave() Class. Basically, you just inherit the class into a new class, and create a method to set the vector position: class N_SndWave(sndobj.SndWave): def resetpos(self): self.SetPos(0) of course, you could also create another method to set the vector position to whatever point you want: class N_SndWave(sndobj.SndWave): def resetpos(self): self.SetPos(0) def setpos(self, offset): self.SetPos(offset) so, in order play a wav file, then reset and play it again, you would do the following: ------ class N_SndWave(sndobj.SndWave): def resetpos(self): self.SetPos(0) wavfile = N_SndWave('C261.wav', 3) wavsoundL = sndobj.SndIn(wavfile,1) wavsoundR = sndobj.SndIn(wavfile,2) outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) outp.SetOutput(2, wavsoundR) outp.SetOutput(1, wavsoundL) N1 = sndobj.SndThread() N1.AddObj(wavfile,sndobj.SNDIO_IN) N1.AddObj(wavsoundR) N1.AddObj(wavsoundL) N1.AddObj(outp, sndobj.SNDIO_OUT) N1.ProcOn() time.sleep(1) wavfile.resetpos() time.sleep(1) N1.ProcOff() ------- by blocks, the above code: 1) Defines new class inherited from SndWave, with method for resetting vector position 2) Sets up standard SndIn->SndObj->SndIO chain, in this case using 2 channels (L&R) 3) Setup SndThread object and add components from 2) 4) Turns SndThread on, plays for 1 second, resets vector to beginning, plays for 1 second, and then stops processing. This seems to do the trick, and the playback is very clean. -Craig On 2/5/07, Craig Lewiston <lew...@mi...> wrote: > I tried #1 & #3 extensively, as well as tinkering with SndRead() > quite a bit. I'm starting to think that in order to accomplish what i > want, I need to be able to reset SndWave() to start reading again from > the beginning of the file. From the documentation for Class SndIO, it > appears that the protected variable m_vecpos holds the value of the > current "place reader" in the wav file. Is there any way to access > this to reset it? > > Better yet, is there a way to copy the wav sample into memory and have > it triggered? > > -Craig > > > > On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: > > Off the top of my head: > > > > 1. Using Enable() and Disable() on the SndIn object to > > switch it on an off. You might get clicks. > > > > 2. Using an envelope (eg. Interp + Ring) and > > trigger the envelope (SetCurve()) on/off. > > Use Ring to multiply the envelope signal by the > > SndIn signal. > > > > 3. If you delete the Wave reader object from > > the thread it will also stop reading the file > > (but SndIn will also need to be disabled) > > > > 4. Have a look at the SndRead class. Another > > alternative is to load the file on a table and > > read it with an oscillator or with Lookup/i > > > > You're right in that ProcOn() and ProcOff() should > > perhaps just be used at the start/end of synthesis. > > > > Victor > > > > > > > > > > Anyone have advice on the best route to creating triggered > > > file playback? I'd like to have my program be able to > > > start the playback of a wav file when a flag is set, and > > > then cease playback of that file once the flag is reset. > > > i want this to happen in a thread, though, because there > > > will be other processing (and sounds) taking place (such > > > as a metronome) while the file is playing back. also, the > > > length of playback will vary depending on when the flag is > > > reset (which is controlled by user input) > > > > > > i'm using SndWave, and patching both channels into SndIn > > > objects. everything is then added to a SndThread: > > > ---------------------- > > > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) > > > wavsoundR = sndobj.SndIn(wavfile,1) > > > wavsoundL = sndobj.SndIn(wavfile,2) > > > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > > > outp.SetOutput(2, wavsoundR) > > > outp.SetOutput(1, wavsoundL) > > > > > > IT = sndobj.SndThread() > > > IT.AddObj(wavfile,sndobj.SNDIO_IN) > > > IT.AddObj(wavsoundR) > > > IT.AddObj(wavsoundL) > > > IT.AddObj(outp, sndobj.SNDIO_OUT) > > > > > > IT.ProcOn() > > > time.sleep(5) > > > IT.ProcOff() > > > ----------------------------------- > > > > > > I thought about just turning the thread on and off, but > > > when the thread is turned on again after being turned off, > > > it just resumes processing where it left off. is there a > > > way i can get it to resume from the beginnig of the wav > > > file? > > > > > > > > > thanks, > > > craig > > > > > > ---------------------------------------------------------- > > > --------------- Using Tomcat but need to do more? Need to > > > support web services, security? Get stuff done quickly > > > with pre-integrated technology to make your job easier. > > > Download IBM WebSphere Application Server v.1.0.1 based on > > > Apache Geronimo > > > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > > _______________________________________________ > > > Sndobj-devel mailing list > > > Snd...@li... > > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > > |
From: Craig L. <lew...@mi...> - 2007-02-06 03:26:06
|
Does anyone have any code employing the SndBuffer Class that they'd care to post to give as an example? I'm interested in anything, but am specifically looking for examples where the Buffer passes data between different threads. Thanks, Craig |
From: Craig L. <lew...@mi...> - 2007-02-06 03:24:38
|
I tried #1 & #3 extensively, as well as tinkering with SndRead() quite a bit. I'm starting to think that in order to accomplish what i want, I need to be able to reset SndWave() to start reading again from the beginning of the file. From the documentation for Class SndIO, it appears that the protected variable m_vecpos holds the value of the current "place reader" in the wav file. Is there any way to access this to reset it? Better yet, is there a way to copy the wav sample into memory and have it triggered? -Craig On 2/5/07, Victor Lazzarini <vic...@nu...> wrote: > Off the top of my head: > > 1. Using Enable() and Disable() on the SndIn object to > switch it on an off. You might get clicks. > > 2. Using an envelope (eg. Interp + Ring) and > trigger the envelope (SetCurve()) on/off. > Use Ring to multiply the envelope signal by the > SndIn signal. > > 3. If you delete the Wave reader object from > the thread it will also stop reading the file > (but SndIn will also need to be disabled) > > 4. Have a look at the SndRead class. Another > alternative is to load the file on a table and > read it with an oscillator or with Lookup/i > > You're right in that ProcOn() and ProcOff() should > perhaps just be used at the start/end of synthesis. > > Victor > > > > > > Anyone have advice on the best route to creating triggered > > file playback? I'd like to have my program be able to > > start the playback of a wav file when a flag is set, and > > then cease playback of that file once the flag is reset. > > i want this to happen in a thread, though, because there > > will be other processing (and sounds) taking place (such > > as a metronome) while the file is playing back. also, the > > length of playback will vary depending on when the flag is > > reset (which is controlled by user input) > > > > i'm using SndWave, and patching both channels into SndIn > > objects. everything is then added to a SndThread: > > ---------------------- > > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) > > wavsoundR = sndobj.SndIn(wavfile,1) > > wavsoundL = sndobj.SndIn(wavfile,2) > > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > > outp.SetOutput(2, wavsoundR) > > outp.SetOutput(1, wavsoundL) > > > > IT = sndobj.SndThread() > > IT.AddObj(wavfile,sndobj.SNDIO_IN) > > IT.AddObj(wavsoundR) > > IT.AddObj(wavsoundL) > > IT.AddObj(outp, sndobj.SNDIO_OUT) > > > > IT.ProcOn() > > time.sleep(5) > > IT.ProcOff() > > ----------------------------------- > > > > I thought about just turning the thread on and off, but > > when the thread is turned on again after being turned off, > > it just resumes processing where it left off. is there a > > way i can get it to resume from the beginnig of the wav > > file? > > > > > > thanks, > > craig > > > > ---------------------------------------------------------- > > --------------- Using Tomcat but need to do more? Need to > > support web services, security? Get stuff done quickly > > with pre-integrated technology to make your job easier. > > Download IBM WebSphere Application Server v.1.0.1 based on > > Apache Geronimo > > > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > > _______________________________________________ > > Sndobj-devel mailing list > > Snd...@li... > > https://lists.sourceforge.net/lists/listinfo/sndobj-devel > |
From: Victor L. <vic...@nu...> - 2007-02-05 22:11:28
|
Off the top of my head: 1. Using Enable() and Disable() on the SndIn object to switch it on an off. You might get clicks. 2. Using an envelope (eg. Interp + Ring) and trigger the envelope (SetCurve()) on/off. Use Ring to multiply the envelope signal by the SndIn signal. 3. If you delete the Wave reader object from the thread it will also stop reading the file (but SndIn will also need to be disabled) 4. Have a look at the SndRead class. Another alternative is to load the file on a table and read it with an oscillator or with Lookup/i You're right in that ProcOn() and ProcOff() should perhaps just be used at the start/end of synthesis. Victor > > Anyone have advice on the best route to creating triggered > file playback? I'd like to have my program be able to > start the playback of a wav file when a flag is set, and > then cease playback of that file once the flag is reset. > i want this to happen in a thread, though, because there > will be other processing (and sounds) taking place (such > as a metronome) while the file is playing back. also, the > length of playback will vary depending on when the flag is > reset (which is controlled by user input) > > i'm using SndWave, and patching both channels into SndIn > objects. everything is then added to a SndThread: > ---------------------- > wavfile = sndobj.SndWave('C261.wav', 3, 2,16) > wavsoundR = sndobj.SndIn(wavfile,1) > wavsoundL = sndobj.SndIn(wavfile,2) > outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) > outp.SetOutput(2, wavsoundR) > outp.SetOutput(1, wavsoundL) > > IT = sndobj.SndThread() > IT.AddObj(wavfile,sndobj.SNDIO_IN) > IT.AddObj(wavsoundR) > IT.AddObj(wavsoundL) > IT.AddObj(outp, sndobj.SNDIO_OUT) > > IT.ProcOn() > time.sleep(5) > IT.ProcOff() > ----------------------------------- > > I thought about just turning the thread on and off, but > when the thread is turned on again after being turned off, > it just resumes processing where it left off. is there a > way i can get it to resume from the beginnig of the wav > file? > > > thanks, > craig > > ---------------------------------------------------------- > --------------- Using Tomcat but need to do more? Need to > support web services, security? Get stuff done quickly > with pre-integrated technology to make your job easier. > Download IBM WebSphere Application Server v.1.0.1 based on > Apache Geronimo > http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel |
From: Craig L. <lew...@mi...> - 2007-02-05 21:55:04
|
Anyone have advice on the best route to creating triggered file playback? I'd like to have my program be able to start the playback of a wav file when a flag is set, and then cease playback of that file once the flag is reset. i want this to happen in a thread, though, because there will be other processing (and sounds) taking place (such as a metronome) while the file is playing back. also, the length of playback will vary depending on when the flag is reset (which is controlled by user input) i'm using SndWave, and patching both channels into SndIn objects. everything is then added to a SndThread: ---------------------- wavfile = sndobj.SndWave('C261.wav', 3, 2,16) wavsoundR = sndobj.SndIn(wavfile,1) wavsoundL = sndobj.SndIn(wavfile,2) outp = sndobj.SndRTIO(2, sndobj.SND_OUTPUT) outp.SetOutput(2, wavsoundR) outp.SetOutput(1, wavsoundL) IT = sndobj.SndThread() IT.AddObj(wavfile,sndobj.SNDIO_IN) IT.AddObj(wavsoundR) IT.AddObj(wavsoundL) IT.AddObj(outp, sndobj.SNDIO_OUT) IT.ProcOn() time.sleep(5) IT.ProcOff() ----------------------------------- I thought about just turning the thread on and off, but when the thread is turned on again after being turned off, it just resumes processing where it left off. is there a way i can get it to resume from the beginnig of the wav file? thanks, craig |
From: todd i. <tes...@as...> - 2007-01-29 15:12:23
|
Certainly you should not be getting the distorted sounds, but one other possibility to try that might be more solid would be to use SyncGrain to generate a "grain" (the beep) at some rate. i can't test it right now, but i would think that would work and would not rely on the time stuff in python. On Jan 29, 2007, at 3:24 AM, Victor Lazzarini wrote: > Instead of turning the thread on and off, you can try using > SndObj::Disable()/Enable() to > turn the processing of an object off (outputs zero thereafter)/on. > Or you > can use SetAmp(0) on the Oscili object that zeros the amplitude. > > Because there are two threads, timing might be slightly wobbly. If you > need precision you can set a callback that calls either method. > This will > be called from the processing thread, always before processing. The > timing resolution then is however many samples your vector is (you > can bring it down to 1 sample if you need). > > Callbacks for SndThread were introduced in the latest version (better > get the latest CVS) and are documented in the latest reference manual. > There are some examples of its use in the python subdir of the > sources. > > Victor > > At 05:55 29/01/2007, Craig Lewiston wrote: >> One use of SndObj in my application is to provide the audio "beep" >> for >> a metronome thread that executes alongside my main program loop (a >> Tkinter GUI). I figured the easiest way to go about this would be to >> stick the following steps inside a loop: >> >> 1) turn the sound on, >> 2) wait for the beep length (in this case 50 ms), >> 3) turn the sound off, >> 4) wait the remainder of time until the next beat. >> >> The four steps would reside inside a loop that executed for the >> duration of the song. However, working towards that end, I've found >> that when i simply attempt to do the following (without putting it in >> a loop): >> >> thread.ProcOn() >> time.sleep(0.05) >> thread.ProcOff() >> time.sleep(0.45) >> >> I don't get the desired effect. I want the sound on for 50 ms, and >> then off for 450 ms. Instead, with the above code, I get 50 ms of >> the >> desired sound (a sine wave in this case), followed by 450 ms of a >> distorted version of the sound. It seems to be a weird interaction >> between SndThread and time.sleep. >> >> When i do this: >> >> thread.ProcOn() >> time.sleep(0.05) >> thread.ProcOff() >> >> or this: >> >> thread.ProcOn() >> time.sleep(0.05) >> >> I get the desired result: 50 ms of a sine wave. (In the second case, >> I really don't understand why it stops WITHOUT the thread.ProcOff() >> statement, but that's not the issue here) >> >> if I do this: >> thread.ProcOn() >> >> I get NO output, which is weird because i would expect it to just >> turn >> the sound on and not turn it off until i hard-closed the Python >> Interpreter. >> >> Here's the full code: >> ------------------------------------ >> import sndobj >> import time >> >> tab = sndobj.HarmTable(5000,2, 1) >> osc = sndobj.Oscili(tab, 3000, 16000) >> outp = sndobj.SndRTIO(1) >> outp.SetOutput(1, osc) >> >> thread = sndobj.SndThread() >> thread.AddObj(osc) >> thread.AddObj(outp, sndobj.SNDIO_OUT) >> >> thread.ProcOn() >> time.sleep(0.05) >> thread.ProcOff() >> time.sleep(0.45) >> ------------------------------------ >> and my system specs: OSX 10.4.8, Powerbook G4, Python 2.4.4 >> >> >> So, I'm sorta at a loss for what to do. I've gone through enough >> trouble to get SndObj up and running (I was using tkSnack before >> [http://www.speech.kth.se/snack/]), which gave me problems of its own >> (intermittent playback quality). I'm trying to figure out if I >> should >> stick through with SndObj for realtime audio processing in my >> application, or look for another module. >> >> Also, concerning the metronome problem, I was wondering if maybe the >> better route to take, instead of creating a loop to start and stop >> the >> sound, would be instead to create one metronome audio track that >> lasts >> the length of the song, and then just play it at the beginning and >> stop it at the end. >> >> Thoughts? >> >> Thanks, >> Craig >> >> --------------------------------------------------------------------- >> ---- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys - and earn >> cash >> http://www.techsay.com/default.php? >> page=join.php&p=sourceforge&CID=DEVDEV >> _______________________________________________ >> Sndobj-devel mailing list >> Snd...@li... >> https://lists.sourceforge.net/lists/listinfo/sndobj-devel > > Victor Lazzarini > Music Technology Laboratory > Music Department > National University of Ireland, Maynooth > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel |
From: Victor L. <Vic...@nu...> - 2007-01-29 11:46:57
|
Perhaps it's a matter of setting buffersizes to match. Crackling audio is generally a sympton of some mismatch somewhere. Victor At 11:04 29/01/2007, sonify wrote: >OK here's the rub: This simple python Jack- code works on intel Mac >OSX10.4.8: > >>import sndobj >> >>tab = sndobj.HarmTable() >>osc = sndobj.Oscili(tab, 440, 16000) >>oput = sndobj.SndJackIO('sine1') >>oput.SetOutput(1, osc) >>thread = sndobj.SndThread() >>thread.AddObj(osc) >>thread.AddObj(oput, sndobj.SNDIO_OUT) > > >but >>oput = sndobj.SndJackIO('sine1' , 1, osc) > >crackles audio through Jack then fails to play. > > >NB Jack has a special setup routine on inte Macs. >Form p12 of the Jack Manual >>The Intel-based Macs present the Built-in Audio device to software >>applications as two >>distinct half-duplex devices: an input device and an output device. For >>proper >>functioning within Jack OS X on Intel Macs, these two devices must be >>aggregated into a single one, using the Mac's Aggregate Device Editor, >>which is >>housed within the Audio MIDI Setup application. > >-David >On 28/01/2007, at 8:37 PM, Victor Lazzarini wrote: > >>Looks correct, but I am afraid I have not >>tested Jack on OSX extensively. I assume your Jack >>server is up and running. >> >>I'll look into the Jack thing on Monday. >> >>Regards >> >>Victor >> >>> >>>Not sure if this is syntactically correct. Please check >>>it. >>> >>>># PySndObj Jack example >>>>import sndobj >>>>import time >>>>tab = sndobj.HarmTable() >>>>osc = sndobj.Oscili(tab, 440, 16000) >>>>oput = sndobj.SndJackIO('sine') >>>>oput.SetOutput(1, osc) >>>> >>>># then either >>>>thread = sndobj.SndThread() >>>>thread.AddObj(osc) >>>>thread.AddObj(oput, sndobj.SNDIO_OUT) >>>>thread.ProcOn() >>>>time.slee (5) >>>>thread.ProcOff() > > > > >_____________________________ >David Worrall: <mailto:so...@av...>so...@av... > > Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
From: Victor L. <Vic...@nu...> - 2007-01-29 11:36:23
|
I wonder whether this is the real reason why SndCoreAudio was not working before. It opens devices full-duplex. So they need to be aggregated in order to work as well. The new code actually checks whether there is an input there and then goes for it. But the device is still opened full-duplex. A-ha. I think I will have some fun figuring all this out when I get an Intel machine... Victor At 11:04 29/01/2007, you wrote: >NB Jack has a special setup routine on inte Macs. >Form p12 of the Jack Manual >The Intel-based Macs present the Built-in Audio device to software >applications as two >distinct half-duplex devices: an input device and an output device. For proper >functioning within Jack OS X on Intel Macs, these two devices must be >aggregated into a single one, using the Mac's Aggregate Device Editor, >which is >housed within the Audio MIDI Setup application. Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
From: sonify <so...@av...> - 2007-01-29 11:04:52
|
OK here's the rub: This simple python Jack- code works on intel Mac =20= OSX10.4.8: > import sndobj > > tab =3D sndobj.HarmTable() > osc =3D sndobj.Oscili(tab, 440, 16000) > oput =3D sndobj.SndJackIO('sine1') > oput.SetOutput(1, osc) > thread =3D sndobj.SndThread() > thread.AddObj(osc) > thread.AddObj(oput, sndobj.SNDIO_OUT) but > oput =3D sndobj.SndJackIO('sine1' , 1, osc) crackles audio through Jack then fails to play. NB Jack has a special setup routine on intel Macs. Form p12 of the Jack Manual > The Intel-based Macs present the Built-in Audio device to software =20 > applications as two > distinct half-duplex devices: an input device and an output device. =20= > For proper > functioning within Jack OS X on Intel Macs, these two devices must be > aggregated into a single one, using the Mac=92s Aggregate Device =20 > Editor, which is > housed within the Audio MIDI Setup application. -David On 28/01/2007, at 8:37 PM, Victor Lazzarini wrote: > Looks correct, but I am afraid I have not > tested Jack on OSX extensively. I assume your Jack > server is up and running. > > I'll look into the Jack thing on Monday. > > Regards > > Victor > >> >> Not sure if this is syntactically correct. Please check >> it. >> >>> # PySndObj Jack example >>> import sndobj >>> import time >>> tab =3D sndobj.HarmTable() >>> osc =3D sndobj.Oscili(tab, 440, 16000) >>> oput =3D sndobj.SndJackIO('sine') >>> oput.SetOutput(1, osc) >>> >>> # then either >>> thread =3D sndobj.SndThread() >>> thread.AddObj(osc) >>> thread.AddObj(oput, sndobj.SNDIO_OUT) >>> thread.ProcOn() >>> time.sleep(5) >>> thread.ProcOff() _____________________________ David Worrall: so...@av... |
From: Victor L. <Vic...@nu...> - 2007-01-29 10:24:18
|
Instead of turning the thread on and off, you can try using SndObj::Disable()/Enable() to turn the processing of an object off (outputs zero thereafter)/on. Or you can use SetAmp(0) on the Oscili object that zeros the amplitude. Because there are two threads, timing might be slightly wobbly. If you need precision you can set a callback that calls either method. This will be called from the processing thread, always before processing. The timing resolution then is however many samples your vector is (you can bring it down to 1 sample if you need). Callbacks for SndThread were introduced in the latest version (better get the latest CVS) and are documented in the latest reference manual. There are some examples of its use in the python subdir of the sources. Victor At 05:55 29/01/2007, Craig Lewiston wrote: >One use of SndObj in my application is to provide the audio "beep" for >a metronome thread that executes alongside my main program loop (a >Tkinter GUI). I figured the easiest way to go about this would be to >stick the following steps inside a loop: > >1) turn the sound on, >2) wait for the beep length (in this case 50 ms), >3) turn the sound off, >4) wait the remainder of time until the next beat. > >The four steps would reside inside a loop that executed for the >duration of the song. However, working towards that end, I've found >that when i simply attempt to do the following (without putting it in >a loop): > >thread.ProcOn() >time.sleep(0.05) >thread.ProcOff() >time.sleep(0.45) > >I don't get the desired effect. I want the sound on for 50 ms, and >then off for 450 ms. Instead, with the above code, I get 50 ms of the >desired sound (a sine wave in this case), followed by 450 ms of a >distorted version of the sound. It seems to be a weird interaction >between SndThread and time.sleep. > >When i do this: > >thread.ProcOn() >time.sleep(0.05) >thread.ProcOff() > >or this: > >thread.ProcOn() >time.sleep(0.05) > >I get the desired result: 50 ms of a sine wave. (In the second case, >I really don't understand why it stops WITHOUT the thread.ProcOff() >statement, but that's not the issue here) > >if I do this: >thread.ProcOn() > >I get NO output, which is weird because i would expect it to just turn >the sound on and not turn it off until i hard-closed the Python >Interpreter. > >Here's the full code: >------------------------------------ >import sndobj >import time > >tab = sndobj.HarmTable(5000,2, 1) >osc = sndobj.Oscili(tab, 3000, 16000) >outp = sndobj.SndRTIO(1) >outp.SetOutput(1, osc) > >thread = sndobj.SndThread() >thread.AddObj(osc) >thread.AddObj(outp, sndobj.SNDIO_OUT) > >thread.ProcOn() >time.sleep(0.05) >thread.ProcOff() >time.sleep(0.45) >------------------------------------ >and my system specs: OSX 10.4.8, Powerbook G4, Python 2.4.4 > > >So, I'm sorta at a loss for what to do. I've gone through enough >trouble to get SndObj up and running (I was using tkSnack before >[http://www.speech.kth.se/snack/]), which gave me problems of its own >(intermittent playback quality). I'm trying to figure out if I should >stick through with SndObj for realtime audio processing in my >application, or look for another module. > >Also, concerning the metronome problem, I was wondering if maybe the >better route to take, instead of creating a loop to start and stop the >sound, would be instead to create one metronome audio track that lasts >the length of the song, and then just play it at the beginning and >stop it at the end. > >Thoughts? > >Thanks, >Craig > >------------------------------------------------------------------------- >Take Surveys. Earn Cash. Influence the Future of IT >Join SourceForge.net's Techsay panel and you'll get the chance to share your >opinions on IT & business topics through brief surveys - and earn cash >http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >_______________________________________________ >Sndobj-devel mailing list >Snd...@li... >https://lists.sourceforge.net/lists/listinfo/sndobj-devel Victor Lazzarini Music Technology Laboratory Music Department National University of Ireland, Maynooth |
From: Craig L. <lew...@mi...> - 2007-01-29 05:55:10
|
One use of SndObj in my application is to provide the audio "beep" for a metronome thread that executes alongside my main program loop (a Tkinter GUI). I figured the easiest way to go about this would be to stick the following steps inside a loop: 1) turn the sound on, 2) wait for the beep length (in this case 50 ms), 3) turn the sound off, 4) wait the remainder of time until the next beat. The four steps would reside inside a loop that executed for the duration of the song. However, working towards that end, I've found that when i simply attempt to do the following (without putting it in a loop): thread.ProcOn() time.sleep(0.05) thread.ProcOff() time.sleep(0.45) I don't get the desired effect. I want the sound on for 50 ms, and then off for 450 ms. Instead, with the above code, I get 50 ms of the desired sound (a sine wave in this case), followed by 450 ms of a distorted version of the sound. It seems to be a weird interaction between SndThread and time.sleep. When i do this: thread.ProcOn() time.sleep(0.05) thread.ProcOff() or this: thread.ProcOn() time.sleep(0.05) I get the desired result: 50 ms of a sine wave. (In the second case, I really don't understand why it stops WITHOUT the thread.ProcOff() statement, but that's not the issue here) if I do this: thread.ProcOn() I get NO output, which is weird because i would expect it to just turn the sound on and not turn it off until i hard-closed the Python Interpreter. Here's the full code: ------------------------------------ import sndobj import time tab = sndobj.HarmTable(5000,2, 1) osc = sndobj.Oscili(tab, 3000, 16000) outp = sndobj.SndRTIO(1) outp.SetOutput(1, osc) thread = sndobj.SndThread() thread.AddObj(osc) thread.AddObj(outp, sndobj.SNDIO_OUT) thread.ProcOn() time.sleep(0.05) thread.ProcOff() time.sleep(0.45) ------------------------------------ and my system specs: OSX 10.4.8, Powerbook G4, Python 2.4.4 So, I'm sorta at a loss for what to do. I've gone through enough trouble to get SndObj up and running (I was using tkSnack before [http://www.speech.kth.se/snack/]), which gave me problems of its own (intermittent playback quality). I'm trying to figure out if I should stick through with SndObj for realtime audio processing in my application, or look for another module. Also, concerning the metronome problem, I was wondering if maybe the better route to take, instead of creating a loop to start and stop the sound, would be instead to create one metronome audio track that lasts the length of the song, and then just play it at the beginning and stop it at the end. Thoughts? Thanks, Craig |
From: Victor L. <vic...@nu...> - 2007-01-28 09:37:42
|
Looks correct, but I am afraid I have not tested Jack on OSX extensively. I assume your Jack server is up and running. I'll look into the Jack thing on Monday. Regards Victor > > Not sure if this is syntactically correct. Please check > it. > > > # PySndObj Jack example > > import sndobj > > import time > > tab = sndobj.HarmTable() > > osc = sndobj.Oscili(tab, 440, 16000) > > oput = sndobj.SndJackIO('sine') > > oput.SetOutput(1, osc) > > > > # then either > > thread = sndobj.SndThread() > > thread.AddObj(osc) > > thread.AddObj(oput, sndobj.SNDIO_OUT) > > thread.ProcOn() > > time.sleep(5) > > thread.ProcOff() > > > > # or > > osc.DoProcess() > > oput.Write() > > time.sleep(5) > > del jack > > del osc > > It bombs on intel Mac on oput assignment, ie the line > > > oput = sndobj.SndJackIO('sine') > > produced our old favourite: bus error. > > Dave > _____________________________ > David Worrall: so...@av... > > > > > ---------------------------------------------------------- > --------------- Take Surveys. Earn Cash. Influence the > Future of IT Join SourceForge.net's Techsay panel and > you'll get the chance to share your opinions on IT & > business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Sndobj-devel mailing list > Snd...@li... > https://lists.sourceforge.net/lists/listinfo/sndobj-devel |
From: sonify <so...@av...> - 2007-01-28 05:58:10
|
Not sure if this is syntactically correct. Please check it. > # PySndObj Jack example > import sndobj > import time > tab = sndobj.HarmTable() > osc = sndobj.Oscili(tab, 440, 16000) > oput = sndobj.SndJackIO('sine') > oput.SetOutput(1, osc) > > # then either > thread = sndobj.SndThread() > thread.AddObj(osc) > thread.AddObj(oput, sndobj.SNDIO_OUT) > thread.ProcOn() > time.sleep(5) > thread.ProcOff() > > # or > osc.DoProcess() > oput.Write() > time.sleep(5) > del jack > del osc It bombs on intel Mac on oput assignment, ie the line > oput = sndobj.SndJackIO('sine') produced our old favourite: bus error. Dave _____________________________ David Worrall: so...@av... |