decodeInstrument in music.ts does not consider offset for amp and pitch LFO's amplitude
Open
Beginner friendly
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 641
- Avg merge
- 12h 4m
- Merged PRs (30d)
- 57
Description
function decodeInstrument(buf: Uint8Array, offset: number): Instrument {
return {
waveform: buf[offset],
ampEnvelope: {
attack: get16BitNumber(buf, offset + 1),
decay: get16BitNumber(buf, offset + 3),
sustain: get16BitNumber(buf, offset + 5),
release: get16BitNumber(buf, offset + 7),
amplitude: get16BitNumber(buf, offset + 9),
},
pitchEnvelope: {
attack: get16BitNumber(buf, offset + 11),
decay: get16BitNumber(buf, offset + 13),
sustain: get16BitNumber(buf, offset + 15),
release: get16BitNumber(buf, offset + 17),
amplitude: get16BitNumber(buf, offset + 19),
},
ampLFO: {
frequency: buf[offset + 21],
amplitude: get16BitNumber(buf, 22) // here
},
pitchLFO: {
frequency: buf[offset + 24],
amplitude: get16BitNumber(buf, 25) // here
},
octave: buf[offset + 27]
}
}
They appear that they should be get16BitNumber(buf, offset + 22) and get16BitNumber(buf, offset + 25) similar to the LFO frequencies and envelopes and waveform.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open pxtlib/music.ts and inspect decodeInstrument, focusing on the ampLFO and pitchLFO amplitude reads identified in the issue. Compare them with the surrounding offset-based envelope and frequency reads; done means both LFO amplitudes are decoded relative to the supplied offset.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- audio-video-rtc
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 88/100