-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaudio.go
More file actions
executable file
·45 lines (35 loc) · 1.39 KB
/
audio.go
File metadata and controls
executable file
·45 lines (35 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
// https://github.com/go-audio
// helpful packages
// Process
// Load audio file
// Debating whether to load all at once, or stream chunk, should allow for both, will load all to start
// Should have a getter then for PCM data and required fields
// Use general audio interface
// File should be played in processed chunks
// Go routine is constantly trying to load more chunks (or at least up to a point)
// Loading chunks
// Get PCM data for current position up to chunk size
// Input that into first row of texture
// Run FFT
// Input that into second row of texture
// Every "Frame"
// Realtime: Get chunk from current frame and process it live
// could also assume a fixed framerate? like yeah we're running hundreds of fps but maybe the audio only runs 60 at a time or whatever
// Frame: Get chunk from current fixed frame
// after chunk obtained, put it in texture
// Possibly have 2 textures and flip between them
// then go on to draw frame
// To play the audio, separately, will want to play stuff with another library
// https://pkg.go.dev/github.com/hajimehoshi/ebiten/v2/audio
// seems promising, from a game engine too
// I think the move is to get a basic version of this, then profile and see if its actually a bottleneck compared with opengl stuff
type AudioLoadType uint8
const (
LoadAll = 0
Stream = 1
)
func CreateAudioTexture() {
}
func LoadAudioFile() {
}