Thanks, I'll try that out! Phil
On Sat, Oct 14, 2017 at 5:36 PM, Clément Bera <bera.clem...@gmail.com> wrote: > Hi Phil, > > I did that using Ronie's OpenAL binding and Merwann's wav parser back in > 2014-2015: > > MCSmalltalkhubRepository > owner: 'ronsaldo' > project: 'OpenAL' > > MCSmalltalkhubRepository > owner: 'MerwanOuddane' > project: 'WAVParser' > > I did things such as (build yourself something derived from this code I > did not check if it works): > > MyClass>>example > WAVParser wavFromStream: ('resources/music/spellNoise.wav' > asFileReference readStream binary readStream). > contextAttributes := ALContextAttributes new. > device := OpenALC openDefaultDevice. > context := device createContext: contextAttributes asList. > context process. > context currentDuring: [ > "Create the buffer" > buffer := self makeBufferFromHeader: wav header data: wav data asByteArray. > "Create the source" > source := OpenAL genSource. > OpenAL sourcei: source param: AL_BUFFER value: buffer. > "Play the source" > OpenAL sourcePlay: source. > "Play for sometime " > (Delay forSeconds: wav header soundDuration) wait. > "Delete the source and the buffer" > OpenAL deleteSource: source; > deleteBuffer: buffer > ]. > OpenALC nullCurrentContext. > context destroy. > device close. > > MyClass>>makeBufferFromHeader: header data: data > | buffer | > buffer := OpenAL genBuffer. > OpenAL bufferData: buffer format: (self readFormatFromHeader: header) > data: data size: data size freq: header sampleRate. > ^ buffer > > MyClass>>readFormatFromHeader: header > ^ header channels = 1 > ifTrue: [ > header bitsPerSample = 8 > ifTrue: [ AL_FORMAT_MONO8 ] > ifFalse: [ AL_FORMAT_MONO16 ] ] > ifFalse: [ > header bitsPerSample = 8 > ifTrue: [ AL_FORMAT_STEREO8 ] > ifFalse: [ AL_FORMAT_STEREO16 ] ] > > I am pretty sure with a little work those things could work again. I have > never succeeded in playing mp3 files from Pharo though (but I'm on mac and > I remembered trying solutions that did not work on Mac but may work on > other OS). > > Have fun guys :-) > > On Sat, Oct 14, 2017 at 10:01 AM, p...@highoctane.be <p...@highoctane.be> > wrote: > >> I'd like to do something like this: https://www.youtube.com/ >> watch?v=vL7D4eU0lYE >> >> to showcase FFI, Bloc, and the Pharo liveliness. >> >> And once I get the basics working, level up in getting it working in a VR >> headset. >> >> Is there anyone having a binding to a library for dealing with the sound >> part, like FMod or other things like that? >> >> I see this as a medium term project, so, like I can get it working by the >> end of the year. >> >> TIA >> >> Phil >> > > > > -- > Clément Béra > Pharo consortium engineer > https://clementbera.wordpress.com/ > Bâtiment B 40, avenue Halley 59650 > <https://maps.google.com/?q=40,+avenue+Halley+59650%C2%A0Villeneuve+d'Ascq&entry=gmail&source=g>Villeneuve > d > <https://maps.google.com/?q=40,+avenue+Halley+59650%C2%A0Villeneuve+d'Ascq&entry=gmail&source=g> > 'Ascq > <https://maps.google.com/?q=40,+avenue+Halley+59650%C2%A0Villeneuve+d'Ascq&entry=gmail&source=g> >