Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add get_notes_stereo #24

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft

Conversation

saimeunt
Copy link

This PR provides initial support for multi-channels by adding a get_notes_stereo function to generate a stereo WAV (simply playing the default melody in the left speaker then right speaker).

I added custom channels support in the upper level directly in the MusicToWavFile converter by interleaving channels in the WAV data, not sure if we need to modify the wave generators?

@tekkac Can you please elaborate on what should I add next to get this done?

@tekkac
Copy link
Collaborator

tekkac commented Apr 14, 2024

A general might be to change the data member of the WavFile struct to handle multiple channels.
maybe change it to channel_data: Span<Span<u32>>.
In the case of stereo, this would be a span with two elements of data such that channel_data[0].len() == channel_data[1].len()

You will need to modify the into impl because the way to actually write the data is to interlace the channels as described in this document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants