BASS.NET API for the Un4seen BASS Audio Library

BassDsdBASS_DSD_StreamCreateFile Method (String, Int64, Int64, BASSFlag, Int32)

BASS.NET API for the Un4seen BASS Audio Library
Creates a sample stream from a DSD file.

This overload implements UNICODE filenames. The BASS_UNICODE flag will be added automatically, since all .Net strings are always unicode.

Namespace:  Un4seen.Bass.AddOn.Dsd
Assembly:  Bass.Net (in Bass.Net.dll) Version: 2.4.17.5
Syntax

public static int BASS_DSD_StreamCreateFile(
	string file,
	long offset,
	long length,
	BASSFlag flags,
	int freq
)

Parameters

file
Type: SystemString
Filename for which a stream should be created.
offset
Type: SystemInt64
File offset to begin streaming from.
length
Type: SystemInt64
Data length... 0 = use all data up to the end of the file.
flags
Type: Un4seen.BassBASSFlag
Any combination of these flags: see BASSFlag.
BASS_DSD_DOPProduce DSD-over-PCM data (with 0x05/0xFA markers). DSD-over-PCM data is 24-bit, so the BASS_SAMPLE_FLOAT flag is required.
BASS_DSD_RAWProduce raw DSD data instead of PCM. The DSD data is in blocks of 8 bits (1 byte) per-channel with the MSB being first/oldest. DSD data is not playable by BASS, so the BASS_STREAM_DECODE flag is required.
freq
Type: SystemInt32
Sample rate to convert the DSD data to PCM at... 0 = use the BASS_CONFIG_DSD_FREQ config setting. The rate will be rounded up (or down if there are none higher) to the nearest valid rate; the valid rates are 1/8, 1/16, 1/32, etc of the DSD rate down to a minimum of 44100 Hz. This parameter is ignored when the BASS_DSD_DOP or BASS_DSD_RAW flag is specified.

Return Value

Type: Int32
If successful, the new stream's handle is returned, else 0 is returned. Use BASS_ErrorGetCode to get the error code.
Remarks

Works almost in the same way BASS_StreamCreateFile(String, Int64, Int64, BASSFlag) does - so for details look there.

All DSD rates (including 48000 Hz variants like 3.072 MHz) with any number of channels are supported, in DSDIFF and DSF containers (DST encoding is not supported). The file's DSD sample rate is available via the BASS_ATTRIB_DSD_RATE attribute.

There are a few types of tag that may be available via BASS_ChannelGetTags. DSDIFF files may include artist and title information, which is available via the BASS_TAG_DSD_ARTIST and BASS_TAG_DSD_TITLE tags, which are ASCII strings. DSDIFF files can also include comments, which are available via the BASS_TAG_DSD_COMMENT+index tag (index=0 is the first comment), which gives a pointer to a BASS_TAG_DSD_COMMENT structure. DSF files may include ID3v2 tags, which are available via the BASS_TAG_ID3V2 tag.

DSD is 6dB quieter than PCM, so a 6dB gain will be applied by default when converting to PCM. That can be changed via the BASS_CONFIG_DSD_GAIN config option and the BASS_ATTRIB_DSD_GAIN attribute.

The DSD-over-PCM (BASS_DSD_DOP) and raw DSD data (BASS_DSD_RAW) options allow supporting devices to play the DSD data directly, without converting to PCM. In both cases, the data needs to reach the device unmodified, so there can be no effects/resampling/mixing or anything else that will modify the data. Raw DSD data is playable with ASIO drivers that support DSD, eg. via BASSASIO. DSD-over-PCM data can be sent to a supporting device in any way that does not modify the data. If DSD-over-PCM data is played on a device that doesn't support it, then it will produce a low level noise.

To stream a file from the internet, use BASS_DSD_StreamCreateURL(String, Int32, BASSFlag, DOWNLOADPROC, IntPtr, Int32). To stream from other locations, see BASS_DSD_StreamCreateFileUser(BASSStreamSystem, BASSFlag, BASS_FILEPROCS, IntPtr, Int32).

See Also

Reference