-
Notifications
You must be signed in to change notification settings - Fork 197
[WIP] record audio to file #28
base: master
Are you sure you want to change the base?
Conversation
Whoah! Nice job. So I think you should be able to do a dual connection. Check out how the Analyser does the scriptProcessor. Make the recorder a component will a callback that wraps the part you want to record, and then you can hook into the UI the same way the Analyser does. |
Thanks! Yeah the wrapping thing might be more in line with the rest of the code base. My thinking was that you never want to record anything but the song itself. But I'll give that a shot! Another idea would be to use an offline audio context to instantly render an explicit number of bars/loops to a file. Since the whole system currently is deterministic (there's no live input/manipulation, right?) there's really no point in letting it play through in realtime to do it. This would probably also be more performant. I noticed that the current implementation suffers a bit from clicks and pops in the recording which most likely is the processor node failing intermittently due to performance issues and too short buffer length. |
Offline would be spectacular, especially with a loop count as a prop. |
Will look into it! Hopefully will have some more time later this week! |
@kenwheeler This is starting to come together! I managed to fix the recorder muting the audio and turned it into a component. I also talked to some web audio peeps and apparently it's not possible to connect a node to two different contexts. So either the "instant" recorder would have to work without the app being playable, or I find a way to duplicate the tree of nodes and connect that copy to the offline context. |
Any status update on this? Is there a work around for accessing the audio context and using a different library to do the recording bit? |
@wyhinton Thanks for checking in with us. This project moved to an "Archived" maintenance status 2 years ago, and is no longer maintained by Formidable. We encourage interested developers to fork this project and make it their own! https://github.com/FormidableLabs/react-music#maintenance-status |
This pr adds a
<Recorder>
component used to generate a wav file of what it's wrapping over. It takes two props,isRecording
andonRecordStop
. The component will start recording as soon as it's created and will stop whenisRecording
is set to false. TheonRecordStop
property is a callback function that will be called with the generated blob when the recording stops. It is up to the user to decide what to do with that data. In the demo app, there's an example of how to generate a download link from the blob of audio.TODO: