|
View:
New views
14 Messages
—
Rating Filter:
Alert me
|
|
|
making audio bit by bitSorry if this has been covered before but has anyone here explored
making audio bit by bit I am not really sure where to start. Say for example I wanted to make 1 second or 44100 samples with the following 16 bits 0010000000100000 in each sample. Is this at all possible It seems a bit crazy, but I am sure there is someone crazy enough to have explored it here. Cheers Simon _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: making audio bit by bitThat would result in silence
On Fri, Jul 4, 2008 at 2:28 AM, simon blackmore <simon@...> wrote: Sorry if this has been covered before but has anyone here explored making audio bit by bit |
|
|
Re: making audio bit by bitYeah apparently its an AC silence at DC-offset 0x1515. I am just curious how you implement such a sound or non sound. I was just looking into the possibilities of burning a visual image onto an audio CD in 0s and 1s. Apparently as this byte gets translated to EFM 00000000100000 on a CD there is a noticeable visual between that and data with more 1s in it. Cheers Simon On 4 Jul 2008, at 14:31, Vytautas Jancauskas wrote: That would result in silence |
|
|
Re: making audio bit by bitOn Jul 4, 2008, at 5:28 AM, simon blackmore wrote:
Not too hard... The only tricky thing is that supercollider always processes sound data normalized to -1.0 .. 1.0, regardless of the bit depth of the hardware output or sound file. So if your input value is relative to 16 bits, you should divide by 32768 to get the corresponding floating-point value. // as a server buffer b = Buffer.alloc(s, 44100, 1, completionMessage: { |buf| buf.fillMsg(0, 44100, 2r0010000000100000 / 32768) }); // prove the values are OK b.getn(0, 100, { |v| (v * 32768).postln }); // or, write directly to a soundfile from the language f = SoundFile("sounds/bits.aiff") .numChannels_(1) .headerFormat_("AIFF") .sampleFormat_("int16"); if(f.openWrite) { d = FloatArray.fill(44100, 2r0010000000100000 / 32768); f.writeData(d); }; f.close; // prove that it's good f = SoundFile.openRead("sounds/bits.aiff"); if(f.isOpen) { d = FloatArray.newClear(100); f.readData(d); (d * 32768).postln; }; f.close; hjh : H. James Harkins : http://www.dewdrop-world.net .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman |
|
|
Re: making audio bit by bitg = Signal.fill(44100,{ arg i; your numbers here }) you can then save it to disk, g.write(path) load it to the server b = Buffer.read(server,path) and play it with a PlayBuf of a SoundFile if its very large. you can also open an audio file for writing and then write numbers directly to the file. also aSignal.waveFill( function, etc. -cx
On Fri, Jul 4, 2008 at 11:28 AM, simon blackmore <simon@...> wrote: Sorry if this has been covered before but has anyone here explored making audio bit by bit |
|
|
Re: making audio bit by bitThanks James, Felix, That seems much easier than I had thought. Cheers Simon
|
|
|
Re: making audio bit by bitFredrik Olofsson made some Ugens that perform bitwise calculations,
which may be helpful in your explorations. You may also want to look at his chip emulation Ugens, because they allow/encourage bitwise changes to their parameters. http://www.fredrikolofsson.com/pages/code-sc.html ~luke > > On Fri, Jul 4, 2008 at 11:28 AM, simon blackmore <simon@...> > wrote: >> >> Sorry if this has been covered before but has anyone here explored making >> audio bit by bit >> >> I am not really sure where to start. Say for example I wanted to make 1 >> second or 44100 samples >> with the following 16 bits 0010000000100000 in each sample. Is this at all >> possible >> >> It seems a bit crazy, but I am sure there is someone crazy enough to have >> explored it here. >> >> Cheers >> >> Simon >> >> >> > > _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
|
|
Re: making audio bit by bitI always wanted to look into doing this in bash with dd or and stdin, havn't really gotten around to it though :)
On Fri, Jul 4, 2008 at 2:28 AM, simon blackmore <simon@...> wrote: Sorry if this has been covered before but has anyone here explored making audio bit by bit |
|
|
Re: making audio bit by bitJust to be absolutely sure... I opened "bits.aiff" in a hex editor and the audio data are 0x202020202020202020... And 0x2020 == 2r0010000000100000, so dividing by 32768 is right. There should be no fp rounding error because 32768 is a power of two. hjh On Jul 4, 2008, at 11:01 AM, James Harkins wrote:
: H. James Harkins : http://www.dewdrop-world.net .::!:.:.......:.::........:..!.::.::...:..:...:.:.:.:..: "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman |
|
|
Re: making audio bit by bitThanks James, Felix and Luke and all, That seems much easier than I had thought. Cheers Simon
|
|
|
Re: making audio bit by bitCould you explain why do we have to divide it by 32768?? What does this number mean? On 04 Ιουλ 2008, at 10:08 ΜΜ, James Harkins wrote:
|
|
|
Re: making audio bit by bitThis is the highest value a sample can take, dividing it by that scales it to -1.0, 1.0
On Mon, Jul 7, 2008 at 6:55 AM, Marinos Koutsomichalis <marinos@...> wrote:
|
|
|
Re: making audio bit by bitOk, so what we actually do is convert the values to decimal float point ones. right? On 07 Ιουλ 2008, at 5:02 ΜΜ, Vytautas Jancauskas wrote: This is the highest value a sample can take, dividing it by that scales it to -1.0, 1.0 |
|
|
Re: making audio bit by bitOn Mon, Jul 7, 2008 at 9:55 AM, Marinos Koutsomichalis
<marinos@...> wrote: > Could you explain why do we have to divide it by 32768?? What does this > number mean? Simon's initial email specified 16 bits of precision. In the integer world, there are 2**16 possible integers that can be expressed using 16 bits, or 65536. Audio signals are signed values, so one bit is used for the sign, leaving 15 bits to represent amplitude, or 32768. So the floating point range -1.0 .. 1.0 gets scaled in the hardware output to -32768 .. 32767 if the hardware out is configured for 16 bits. And, if you want to scale a known integer amplitude into -1.0 .. 1.0, you divide by the largest possible integer amplitude, which is the absolute value of -32768. 32767 == 2r0111111111111111 or the largest positive signed integer that will fit into 16 bits (0 is the sign bit) -32768 == 2r1000000000000000 or the largest negative signed integer that will fit into 16 bits hjh -- James Harkins /// dewdrop world jamshark70@... http://www.dewdrop-world.net "Come said the Muse, Sing me a song no poet has yet chanted, Sing me the universal." -- Whitman _______________________________________________ sc-users mailing list info (subscribe and unsubscribe): http://swiki.hfbk-hamburg.de:8888/MusicTechnology/880 archive: http://www.listarc.bham.ac.uk/marchives/sc-users/ search: http://www.listarc.bham.ac.uk/lists/sc-users/search/ |
| Free Forum Powered by Nabble | Forum Help |