Giter Site home page Giter Site logo

goaudio's Introduction

GoAudio ๐ŸŽถ

Build Status Mentioned in Awesome Go

GoAudio is an audio processing library, currently supporting WAVE files, although some tools such as the synth and breakpoints are encoding-agnostic, so you could combine them with a different library for storing the data and using GoAudio only as a means to generate the waveforms.

Features

Blog

If you want to know more about how this code works and what you can do with it, I write about this code and other audio related programs over on my blog: dylanmeeus.github.io.

goaudio's People

Contributors

dylanmeeus avatar egonelbre avatar ngyewch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

goaudio's Issues

Handle 'JUNK' chunks when reading in wave files

I was trying to use this module to read in this wave file and was having some trouble.

It looks like before the "fmt" chunk, it's possible to have a chunk that begins with "JUNK" that should be skipped.

I believe it's described in this page talking about the "RIFF" format: https://www.daubnet.com/en/file-format-riff
The fix would go around here: https://github.com/DylanMeeus/GoAudio/blob/master/wave/reader.go#L60

Tangentially, there was a similar issue on the tensorflow project: tensorflow/tensorflow#26247

PCM to WAV

Hello there,

I want to create a wav file from PCM raw data but I can't, can you help me how can I approach this goal?
PCM data is basically slice of bytes []byte(" ")

Metronome

Hi. Could you add an example on how to synth a metronome sound?

wave.ReadWaveFile segfault on 24bit wav files

Greetings!

It looks like parseRawData() segfaults on 24bit wav files, because there's no conversion function defined here

	byteSizeToIntFunc = map[int]bytesToIntF{
		16: bits16ToInt,
		32: bits32ToInt,
	}
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x10a3643]

goroutine 1 [running]:
github.com/DylanMeeus/GoAudio/wave.parseRawData(0xc00010000c, 0x4, 0x102880, 0x10, 0x1, 0x2, 0xac44, 0x40998, 0x6, 0x18, ...)
	...go/pkg/mod/github.com/!dylan!meeus/[email protected]/wave/reader.go:145 +0x143
github.com/DylanMeeus/GoAudio/wave.ReadWaveFile(0x10d7ea8, 0x13, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)

I imagine the omission is due to there being no math constant defined for a max 24bit integer, which is understandable. It looks like other packages work around this by simply defining their own -- either by defining it as 8bitmax+16bitmax, or, in the case of mysql:

const (
	MaxUint24 = 1<<24 - 1
	MaxInt24  = 1<<23 - 1
	MinInt24  = -1 << 23
)

I'm happy to drop a PR if it'd be helpful, but I figured I'd just give you a heads up first, as I'm not 100% sure that my solution is correct

Cheers,

Lowpass/Highpass bug

Hi,
It seems that neither lowpass nor highpass functions are working.
One issue that i can see is that they return a float64 slice filled with 0s, due to this line:

  output := make([]float64, len(fs))
   copy(fs, output)
   ////// Should be copy(output, fs)

Same bug exists in both functions (Lowpass and Highpass).

Another issue is even when the above is fixed and the returned data is imported into Audacity for spectrum analysis, you can see that it looks identical to unfiltered data, eg: no low/high pass filtering is taking affect.

Thank you

NICE

THIS IS VERY NICE

Refactor Gtable from Struct to Type Alias

Gtable is just a lightweight wrapper around []float64 at the moment.
This can be refactored into a type Gtable []float64 alias. Or, even better perhaps, type Table []float64 to represent any kind of table (guard table / wave table).

Examples

Hello there,

how can I use GoAudio to write a wav file from PCM_LINEAR16 slice of bytes?
audioPCMBytes is bytes from an audio.raw with 1 channel

audioPCMBytes:=[]byte("......")
// to .wav file

is possible?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.