Save and play wav file

#1

I am having difficulty saving and playing a .wav file in Expo. I am generating a .wav file in my app, and want to be able to play it after generating it. Unfortunately, it looks like the Audio API does not provide an interface for passing data directly, so I have to first generate a uri, or save the file and get the file uri. The data exists as a blob currently, but createObjectURL returns ‘Cannot create URL for blob!’. I have been trying to figure out how I can save the data, but haven’t found a way of doing this in Expo yet. How can I save this data to a file? Is there any way I can pass it directly to the Audio API, instead of going through the filesystem?

#2

hey @fwallace, you should be able to do it via the Filesystem API, see this thread: How to play audio from a local file?

#3

Any idea how I can save the data to a file? Currently, the audio lives in memory, which is what’s preventing me from being able to play it.

#4

I don’t believe we currently expose a way to pass raw PCM data down to the FileSystem. However, our Audio Recording API supports outputting a recording directly to a file in a variety of formats.

closed #5

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.