Giter Club home page Giter Club logo

musig's Issues

Segfault on 24bit 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,

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.