-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
splincode
committed
May 4, 2023
1 parent
32fd540
commit 9918bc8
Showing
99 changed files
with
2,231 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import {Pipe, PipeTransform} from '@angular/core'; | ||
import {AudioParamInput} from '@ng-web-apis/audio'; | ||
|
||
@Pipe({ | ||
name: 'adsr', | ||
}) | ||
export class AdsrPipe implements PipeTransform { | ||
transform( | ||
value: number, | ||
attack: number, | ||
decay: number, | ||
sustain: number, | ||
release: number, | ||
): AudioParamInput { | ||
return value | ||
? [ | ||
{ | ||
value: 0, | ||
duration: 0, | ||
mode: 'instant', | ||
}, | ||
{ | ||
value, | ||
duration: attack, | ||
mode: 'linear', | ||
}, | ||
{ | ||
value: sustain, | ||
duration: decay, | ||
mode: 'linear', | ||
}, | ||
] | ||
: { | ||
value: 0, | ||
duration: release, | ||
mode: 'linear', | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
<ng-container *ngIf="notes$ | async as notes"> | ||
<ng-container *ngFor="let note of notes | keyvalue; trackBy: noteKey"> | ||
<ng-container *ngIf="note.value !== null"> | ||
<ng-container | ||
waOscillatorNode | ||
detune="5" | ||
autoplay | ||
[frequency]="note.key | frequency" | ||
> | ||
<ng-container | ||
waGainNode | ||
gain="0" | ||
[gain]="note.value | adsr: 0:0.1:note.value * 0.8:1" | ||
> | ||
<ng-container waAudioDestinationNode></ng-container> | ||
</ng-container> | ||
</ng-container> | ||
<ng-container | ||
waOscillatorNode | ||
type="sawtooth" | ||
autoplay | ||
[frequency]="note.key | frequency" | ||
> | ||
<ng-container | ||
waGainNode | ||
gain="0" | ||
[gain]="note.value | adsr: 0:0.1:note.value * 0.8:1" | ||
> | ||
<ng-container | ||
waAudioDestinationNode | ||
(quiet)="onQuiet(note?.key)" | ||
></ng-container> | ||
<ng-container [waOutput]="convolver"></ng-container> | ||
</ng-container> | ||
</ng-container> | ||
</ng-container> | ||
</ng-container> | ||
<ng-container | ||
#convolver="AudioNode" | ||
waConvolverNode | ||
[buffer]="response | async" | ||
> | ||
<ng-container waAudioDestinationNode></ng-container> | ||
</ng-container> | ||
|
||
<div | ||
*ngFor="let key of octaves" | ||
[class]="getClass(notes, key)" | ||
(mousedown)="onMouseDown(key)" | ||
(touchstart)="onMouseDown(key)" | ||
></div> | ||
</ng-container> |
Oops, something went wrong.